# Problem 9
# A Pythagorean triplet is a set of three natural numbers, a  b  c, for which,
# a^2 + b^2 = c^2
# For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
# There exists exactly one Pythagorean triplet for which a + b + c = 1000.
# Find the product abc.

import unittest


def getPythagoreanTripletProduct(sum):
    for c in range(1, sum):
        for b in range(1, sum):
            for a in range(1, sum):
                if a + b + c == sum:
                    if c * c == a * a + b * b:
                        print a, b, c
                        return a * b * c
                    else:
                        break
    return 0;

    
class TestP009(unittest.TestCase):
    def test_getGreatestNConsecutiveDigits(self):
        self.assertEqual(getPythagoreanTripletProduct(12), 60)
        


if __name__ == '__main__':
    P009 = unittest.TestLoader().loadTestsFromTestCase(TestP009)
    unittest.TextTestRunner(verbosity=2).run(P009)
    print "Product abc of Pythagorean triplet for which a + b + c = 1000 is [%d]" % getPythagoreanTripletProduct(1000)